package com.pinda.feign.baseapi.user;

//import com.itheima.pinda.DTO.user.TruckDriverDto;
//import com.itheima.pinda.DTO.user.TruckDriverLicenseDto;
//import com.itheima.pinda.common.utils.PageResponse;
import com.pinda.commonutils.utils.PageResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import com.pinda.base.entity.PdTruckDriver;
import com.pinda.base.entity.PdTruckDriverLicense;
import java.util.List;

@FeignClient(name = "base-service",contextId = "DriverFeign",url = "http://localhost:2003")
@RequestMapping("sys/driver")
@ApiIgnore
public interface DriverFeign {
    /**
     * 保存司机基本信息
     *
     * @param dto 司机基本信息
     * @return 返回信息
     */
    @PostMapping
    PdTruckDriver saveDriver(@RequestBody PdTruckDriver dto);

    /**
     * 获取司机基本信息列表
     *
     * @param userIds 司机id列表
     * @param fleetId 车队id
     * @return 司机基本信息列表
     */
    @GetMapping
    List<PdTruckDriver> findAllDriver(@RequestParam(name = "userIds",required = false) List<String> userIds, @RequestParam(name = "fleetId",required = false) String fleetId);

    /**
     * 获取司机基本信息
     *
     * @param id 司机id
     * @return 司机基本信息
     */
    @GetMapping("/{id}")
    PdTruckDriver findOneDriver(@PathVariable(name = "id") String id);

    /**
     * 保存司机驾驶证信息
     *
     * @param dto 司机驾驶证信息
     * @return 返回信息
     */
    @PostMapping("/driverLicense")
    PdTruckDriverLicense saveDriverLicense(@RequestBody PdTruckDriverLicense dto);

    /**
     * 获取司机驾驶证信息
     *
     * @param id 司机id
     * @return 司机驾驶证信息
     */
    @GetMapping("/{id}/driverLicense")
    PdTruckDriverLicense findOneDriverLicense(@PathVariable(name = "id") String id);

    /**
     * 统计司机数量
     *
     * @param fleetId 车队id
     * @return 司机数量
     */
    @GetMapping("/count")
    Integer count(@RequestParam(name = "fleetId", required = false) String fleetId);

    /**
     * 获取司机分页数据
     *
     * @param page     页码
     * @param pageSize 页尺寸
     * @param fleetId  车队id
     * @return 司机分页数据
     */
    @GetMapping("/page")
    PageResponse<PdTruckDriver> findByPage(@RequestParam(name = "page") Integer page,
                                           @RequestParam(name = "pageSize") Integer pageSize,
                                           @RequestParam(name = "fleetId", required = false) String fleetId);


    /**
     * 查询全部
     * @param ids
     * @return
     */
    @GetMapping("/findAll")
    List<PdTruckDriver> findAll(@RequestParam(name = "ids", required = false) List<String> ids);
}
